package com.huafeng.model.exception;

import com.huafeng.model.enums.ResultCodeEnum;

/**
 * @author 花风
 * @date 2023/8/15 21:09
 * @Description 自定义异常
 */
public class BusinessException extends RuntimeException {
    private final int code;

    public BusinessException(ResultCodeEnum resultCodeEnum){
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }

    public BusinessException(int code,String message){
        super(message);
        this.code = code;
    }

    public BusinessException(ResultCodeEnum resultCodeEnum,String message){
        super(message);
        this.code = resultCodeEnum.getCode();
    }

    public int getCode() {
        return code;
    }
}
